#include<iostream>
using namespace std;

int main()
{
	int max_time = 0;
	int n = 0;	
	for (int i = 0; i < 7; i++)
	{
		int a, b;
		cin >> a >> b;
		if (a + b > max_time && a + b > 8)
		{
			n = i + 1;
			max_time = a + b;
		}
	}
	cout << n << endl; 
	
	return 0;
}

